package com.dongdongshop.service.impl;
import com.dongdongshop.mapper.TbItemCatMapper;
import com.dongdongshop.mapper.TbTypeTemplateMapper;
import com.dongdongshop.pojo.TbItemCat;
import com.dongdongshop.pojo.TbTypeTemplate;
import com.dongdongshop.service.TbItemCatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@com.alibaba.dubbo.config.annotation.Service
public class TbItemCatServiceImpl implements TbItemCatService {
    @Autowired
    private TbItemCatMapper tbItemCatMapper;
    @Autowired
    private TbTypeTemplateMapper tbTypeTemplateMapper;
    @Override
    public List<TbItemCat> selectById(Long pid) {
         List<TbItemCat> tbItemCats =  tbItemCatMapper.selectBypid(pid);
        return tbItemCats;
    }
    @Override
    public void addAll(TbItemCat tbItemCat) {
        tbItemCatMapper.insertSelective(tbItemCat);
    }
    @Override
    public TbItemCat findItemById(Long id) {
        TbItemCat tbItemCat = tbItemCatMapper.selectByPrimaryKey(id);
        return tbItemCat;
    }
    @Override
    public void updateItem(TbItemCat tbItemCat) {
        tbItemCatMapper.updateByPrimaryKeySelective(tbItemCat);
    }
    @Override
    public void deleteBatch(Long[] ids) {
        tbItemCatMapper.deleteBatch(ids);
    }

    @Override
    public TbTypeTemplate getInfo(Long pid) {
        TbItemCat tbItemCat = tbItemCatMapper.selectByPrimaryKey(pid);
        TbTypeTemplate tbTypeTemplate = tbTypeTemplateMapper.selectByPrimaryKey(tbItemCat.getTypeId());
        return tbTypeTemplate;
    }
}
